<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
	</head>
	<body>
		
	</body>
</html>
<script>
	//继承
	function Animal(type, enviroment){
		this.type = type;
		this.enviroment = enviroment;
	}
	//如何让猫类继承与动物类
	function Cat(type, enviroment, color, age){
		//this.type = type;
		//this.enviroment = enviroment;
		Animal.call(this,type,enviroment);
		//用法同call，只不过函数的参数放到了数组中
		Animal.apply(this,[type,enviroment]);
		this.color = color;
		this.age = age;
	}
	var c = new Cat("波斯猫", "家里蹲", "雪白", 1);
	console.log(c.type,c.enviroment,c.color,c.age);
</script>